import Vue from "vue";
import Vuex from "vuex";
import admin from "./admin";
import shop from "./shop";
import goods from "./goods";

Vue.use(Vuex);
const state = {
  loading: false,           //数据是否加载完成
  pageSum: 1,               //设置总页数
  pageIndex: 1              //设置页数下标
}
const mutations = {
  //是否加载完成
  CHANGE_LOADING(state, bool) {
    state.loading = bool;
  },
  //修改总页数
  CHANGE_PAGE_SUM(state, pageSum) {
    state.pageSum = pageSum;
  },
  //设置下标
  CHANGE_PAGE_INDEX(state, pageIndex) {
    state.pageIndex = pageIndex;
  }
}
const modules = {
  admin,
  shop,
  goods
}

export default new Vuex.Store({
  state,
  mutations,
  actions: {},
  modules
});
